<template>
	<view class="tabbar">
		<u-tabbar :value="currentTab" :fixed="true" activeColor="#E73E52" :placeholder="true"
			zIndex='1000'>
			<u-tabbar-item text="首页" icon="home" name="index" @click="handTab(0)" />
			<u-tabbar-item text="活动" icon="coupon" name='activity' @click="handTab(1)"/>
			<u-tabbar-item text="订单" icon="order"  name="order" @click="handTab(2)" />
			<u-tabbar-item text="我的" icon="account" name="user" @click="handTab(3)" />
		</u-tabbar>
	</view>
</template>
 
<script>
	export default {
		name: "TabBar",
		props: {
			currentTab: {
				type: String,
				default: 'index'
			}
		},
		data() {
			return {
				switchTab: [
					"/pages/index/index",
					"/pages/activity/index",
					"/pages/order/index",
					"/pages/user/index"
				]
			}
		},
		methods: {
			handTab(index) {
				uni.switchTab({
					url: this.switchTab[index]
				})
			}
		}
	}
</script>